#ifndef CP1252_HEADER
#define CP1252_HEADER

// this header needs
#include <stdio.h>
#include "../ARRAY.h"
#include "ASCII.h" // CP1252 is an extension to ASCII
#include "UNICD.h"

// epik CP1252 map table
// some important constants are defined here
#include "CP1252_U_TB.h"

typedef umax cp1252_int;
// the encoded representation is the same as the integer representation

// Windows 1252 is an extension of the ASCII character set
// and it maps characters from 0x00 to 0xFF (the whole byte bits)
// (except for the 0x81, 0x8D, 0x8F, 0x90 and 0x9D positions)
// to check if a byte is a CP1252 character you have to basically
// check if the byte it is not a 0x81, 0x8D, 0x8F, 0x90 or 0x9D

#define MIN_CP1252_INT  0x00
#define MAX_CP1252_INT  0xFF
#define INV_CP1252_INT  0x81
#define INV_CP1252_INT2 0x8D
#define INV_CP1252_INT3 0x8F
#define INV_CP1252_INT4 0x90
#define INV_CP1252_INT5 0x9D
#define INV_CP1252_INT_STR "[INV_CP1252_INT]"
#define INV_ENC_CP1252_STR "[INV_ENC_CP1252]"

// this encoding inherits the ASCII table characters

// table definitions
#define CP1252_ASCII_INT_CTRL_CHARS_START  0x00
#define CP1252_ASCII_INT_CTRL_CHARS_END    0x19
#define CP1252_ASCII_INT_PRINT_CHARS_START 0x20
#define CP1252_ASCII_INT_PRINT_CHARS_END   0x7F
#define CP1252_ASCII_INT_COMMA             0x2C
#define CP1252_ASCII_INT_NEWLN             0xA0
#define CP1252_ASCII_INT_WHITESPACE_LENGTH 6
cp1252_int * CP1252_ASCII_INT_WHITESPACE = ASCII_INT_WHITESPACE;

#define CP1252_ASCII_INT_NUMBER_BEGIN 0
#define CP1252_ASCII_INT_NUMBER_HEX_UPPER_BEGIN 10
#define CP1252_ASCII_INT_NUMBER_HEX_LOWER_BEGIN 16
#define CP1252_ASCII_INT_NUMBER_PMDX_BEGIN 22
#define CP1252_ASCII_INT_NUMBER_LENGTH 26
cp1252_int * CP1252_ASCII_INT_NUMBER = ASCII_INT_NUMBER;

// checking
byte check_cp1252_int(cp1252_int ch);
byte check_enc_cp1252(void * src, umax ssize);
// get/write
cp1252_int get_cp1252_int(void * src, umax ssize);
void * write_enc_cp1252(cp1252_int ch, void * dest, umax dsize);
// printing
byte print_cp1252_int(cp1252_int ch);
byte print_enc_cp1252(void * src, umax ssize);

// unicode conversion related

// checking
byte check_cp1252_as_unicd(cp1252_int ch);
bool check_unicd_as_cp1252(unicd_int ch);
// getting
unicd_int get_cp1252_as_unicd(cp1252_int ch);
cp1252_int get_unicd_as_cp1252(unicd_int ch);

#include "CP1252.c"

#endif // CP1252_HEADER
